<!-- HTML header for doxygen 1.8.13-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>MTB CAT1 Peripheral driver library: High-Level</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen_style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><a href="http://www.cypress.com/"><img alt="Logo" src="IFXCYP_one-line.png"/></a></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">MTB CAT1 Peripheral driver library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('group__group__sd__host__high__level__functions.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">High-Level<div class="ingroups"><a class="el" href="group__group__sd__host.html">SD Host      (SD Host Controller)</a> &raquo; <a class="el" href="group__group__sd__host__functions.html">Functions</a></div></div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">General Description</h2>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga9d72dcc2426210eef77fa5b95eefb986"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__sd__host__enums.html#gabbf5bb6a131cd8b9c529b7e36b35fe23">cy_en_sd_host_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__sd__host__high__level__functions.html#ga9d72dcc2426210eef77fa5b95eefb986">Cy_SD_Host_InitCard</a> (SDHC_Type *base, <a class="el" href="structcy__stc__sd__host__sd__card__config__t.html">cy_stc_sd_host_sd_card_config_t</a> *config, <a class="el" href="structcy__stc__sd__host__context__t.html">cy_stc_sd_host_context_t</a> *context)</td></tr>
<tr class="memdesc:ga9d72dcc2426210eef77fa5b95eefb986"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initializes a card if it is connected.  <a href="#ga9d72dcc2426210eef77fa5b95eefb986">More...</a><br /></td></tr>
<tr class="separator:ga9d72dcc2426210eef77fa5b95eefb986"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga651eeea3b4c0a433db932db34ba7a222"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__sd__host__enums.html#gabbf5bb6a131cd8b9c529b7e36b35fe23">cy_en_sd_host_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__sd__host__high__level__functions.html#ga651eeea3b4c0a433db932db34ba7a222">Cy_SD_Host_Read</a> (SDHC_Type *base, <a class="el" href="structcy__stc__sd__host__write__read__config__t.html">cy_stc_sd_host_write_read_config_t</a> *config, <a class="el" href="structcy__stc__sd__host__context__t.html">cy_stc_sd_host_context_t</a> const *context)</td></tr>
<tr class="memdesc:ga651eeea3b4c0a433db932db34ba7a222"><td class="mdescLeft">&#160;</td><td class="mdescRight">Reads single- or multiple-block data from the SD card / eMMC.  <a href="#ga651eeea3b4c0a433db932db34ba7a222">More...</a><br /></td></tr>
<tr class="separator:ga651eeea3b4c0a433db932db34ba7a222"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaacf4fbad1af632a2b7fe82980b15e8ae"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__sd__host__enums.html#gabbf5bb6a131cd8b9c529b7e36b35fe23">cy_en_sd_host_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__sd__host__high__level__functions.html#gaacf4fbad1af632a2b7fe82980b15e8ae">Cy_SD_Host_Write</a> (SDHC_Type *base, <a class="el" href="structcy__stc__sd__host__write__read__config__t.html">cy_stc_sd_host_write_read_config_t</a> *config, <a class="el" href="structcy__stc__sd__host__context__t.html">cy_stc_sd_host_context_t</a> const *context)</td></tr>
<tr class="memdesc:gaacf4fbad1af632a2b7fe82980b15e8ae"><td class="mdescLeft">&#160;</td><td class="mdescRight">Writes single- or multiple-block data to the SD card / eMMC.  <a href="#gaacf4fbad1af632a2b7fe82980b15e8ae">More...</a><br /></td></tr>
<tr class="separator:gaacf4fbad1af632a2b7fe82980b15e8ae"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gabfb5430ccafd3a7a84b3bdf7eb106c98"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__sd__host__enums.html#gabbf5bb6a131cd8b9c529b7e36b35fe23">cy_en_sd_host_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__sd__host__high__level__functions.html#gabfb5430ccafd3a7a84b3bdf7eb106c98">Cy_SD_Host_Erase</a> (SDHC_Type *base, uint32_t startAddr, uint32_t endAddr, <a class="el" href="group__group__sd__host__enums.html#gafcc446fe80b86a86f74ba7794d1e3a8d">cy_en_sd_host_erase_type_t</a> eraseType, <a class="el" href="structcy__stc__sd__host__context__t.html">cy_stc_sd_host_context_t</a> const *context)</td></tr>
<tr class="memdesc:gabfb5430ccafd3a7a84b3bdf7eb106c98"><td class="mdescLeft">&#160;</td><td class="mdescRight">Erases the number block data of the SD card / eMMC.  <a href="#gabfb5430ccafd3a7a84b3bdf7eb106c98">More...</a><br /></td></tr>
<tr class="separator:gabfb5430ccafd3a7a84b3bdf7eb106c98"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga9d72dcc2426210eef77fa5b95eefb986"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga9d72dcc2426210eef77fa5b95eefb986">&#9670;&nbsp;</a></span>Cy_SD_Host_InitCard()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__sd__host__enums.html#gabbf5bb6a131cd8b9c529b7e36b35fe23">cy_en_sd_host_status_t</a> Cy_SD_Host_InitCard </td>
          <td>(</td>
          <td class="paramtype">SDHC_Type *&#160;</td>
          <td class="paramname"><em>base</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcy__stc__sd__host__sd__card__config__t.html">cy_stc_sd_host_sd_card_config_t</a> *&#160;</td>
          <td class="paramname"><em>config</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcy__stc__sd__host__context__t.html">cy_stc_sd_host_context_t</a> *&#160;</td>
          <td class="paramname"><em>context</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Initializes a card if it is connected. </p>
<p>After this function is called, the card is in the transfer state.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*base</td><td>The SD host registers structure pointer.</td></tr>
    <tr><td class="paramname">*config</td><td>The pointer to the SD card configuration structure.</td></tr>
    <tr><td class="paramname">context</td><td>The pointer to the context structure <a class="el" href="structcy__stc__sd__host__context__t.html">cy_stc_sd_host_context_t</a> allocated by the user. The structure is used during the SD host operation for internal configuration and data retention. The user must not modify anything in this structure. If only the SD host functions which do not require context will be used, pass NULL as the pointer to the context.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group__group__sd__host__enums.html#gabbf5bb6a131cd8b9c529b7e36b35fe23">cy_en_sd_host_status_t</a></dd></dl>
<dl class="section note"><dt>Note</dt><dd>When lowVoltageSignaling is True, this function negotiates with the card to change the bus signaling level to 1.8V. The dedicated io_volt_sel pin is used to change the regulator supplying voltage to the VDDIO of the SD block in order to operate at 1.8V. To configure the custom IO pin in order to control (using the GPIO driver) the regulator supplying voltage, the user must implement weak <a class="el" href="group__group__sd__host__low__level__functions.html#ga307ae5aea7a503f9cac590dd895a8d36" title="Changes the logic level on the sd_io_volt_sel line. ">Cy_SD_Host_ChangeIoVoltage()</a>. Also, this function must set the SIGNALING_EN bit of the SDHC_CORE_HOST_CTRL2_R register when ioVoltage = CY_SD_HOST_IO_VOLT_1_8V.</dd>
<dd>
lowVoltageSignaling is not supported for CAT1C devices.</dd>
<dd>
After calling this function, the SD Host is configured in highest supported bus speed mode (for the SD card, irrespective of the value of lowVoltageSignaling), or eMMC legacy (for the eMMC card) with SD clock = 25 MHz. The Power Limit and Driver Strength functions of the CMD6 command are set into the default state (0.72 W and Type B). It is the user's responsibility to set Power Limit and Driver Strength depending on the capacitance load of the host system. To change Speed mode, the user must call the <a class="el" href="group__group__sd__host__low__level__functions.html#ga0b48a86672163e3be31362d7b3de0730" title="Negotiates with the card to change the bus speed mode of the card and the host. ">Cy_SD_Host_SetBusSpeedMode()</a> and Cy_SD_Host_SdCardChangeClock() functions. Additionally, SD SDR25, SD SDR50, eMMC High Speed SDR modes require settings CLOCK_OUT_DLY and CLOCK_IN_DLY bit-fields of the GP_OUT_R register. For more information about Speed modes, refer to Part 1 Physical Layer SD Specification. </dd></dl>

</div>
</div>
<a id="ga651eeea3b4c0a433db932db34ba7a222"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga651eeea3b4c0a433db932db34ba7a222">&#9670;&nbsp;</a></span>Cy_SD_Host_Read()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__sd__host__enums.html#gabbf5bb6a131cd8b9c529b7e36b35fe23">cy_en_sd_host_status_t</a> Cy_SD_Host_Read </td>
          <td>(</td>
          <td class="paramtype">SDHC_Type *&#160;</td>
          <td class="paramname"><em>base</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcy__stc__sd__host__write__read__config__t.html">cy_stc_sd_host_write_read_config_t</a> *&#160;</td>
          <td class="paramname"><em>config</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcy__stc__sd__host__context__t.html">cy_stc_sd_host_context_t</a> const *&#160;</td>
          <td class="paramname"><em>context</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Reads single- or multiple-block data from the SD card / eMMC. </p>
<p>If DMA is not used this function blocks until all data is read. If DMA is used all data is read when the Transfer complete event is set. It is the user responsibility to check and reset the transfer complete event (using <a class="el" href="group__group__sd__host__interrupt__functions.html#gad4a09951afc276a483c93e5e158528f3">Cy_SD_Host_GetNormalInterruptStatus</a> and <a class="el" href="group__group__sd__host__interrupt__functions.html#ga95975e199a0669a600e2fe5ada69b892">Cy_SD_Host_ClearNormalInterruptStatus</a> functions).</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*base</td><td>The SD host registers structure pointer.</td></tr>
    <tr><td class="paramname">*config</td><td>The pointer to the SD card read-write structure.</td></tr>
    <tr><td class="paramname">context</td><td>The pointer to the context structure <a class="el" href="structcy__stc__sd__host__context__t.html">cy_stc_sd_host_context_t</a> allocated by the user. The structure is used during the SD host operation for internal configuration and data retention. The user must not modify anything in this structure. If only the SD host functions which do not require context will be used, pass NULL as the pointer to the context.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group__group__sd__host__enums.html#gabbf5bb6a131cd8b9c529b7e36b35fe23">cy_en_sd_host_status_t</a> </dd></dl>

</div>
</div>
<a id="gaacf4fbad1af632a2b7fe82980b15e8ae"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaacf4fbad1af632a2b7fe82980b15e8ae">&#9670;&nbsp;</a></span>Cy_SD_Host_Write()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__sd__host__enums.html#gabbf5bb6a131cd8b9c529b7e36b35fe23">cy_en_sd_host_status_t</a> Cy_SD_Host_Write </td>
          <td>(</td>
          <td class="paramtype">SDHC_Type *&#160;</td>
          <td class="paramname"><em>base</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcy__stc__sd__host__write__read__config__t.html">cy_stc_sd_host_write_read_config_t</a> *&#160;</td>
          <td class="paramname"><em>config</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcy__stc__sd__host__context__t.html">cy_stc_sd_host_context_t</a> const *&#160;</td>
          <td class="paramname"><em>context</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Writes single- or multiple-block data to the SD card / eMMC. </p>
<p>If DMA is not used this function blocks until all data is written. If DMA is used all data is written when the Transfer complete event is set. It is the user responsibility to check and reset the transfer complete event (using <a class="el" href="group__group__sd__host__interrupt__functions.html#gad4a09951afc276a483c93e5e158528f3">Cy_SD_Host_GetNormalInterruptStatus</a> and <a class="el" href="group__group__sd__host__interrupt__functions.html#ga95975e199a0669a600e2fe5ada69b892">Cy_SD_Host_ClearNormalInterruptStatus</a> functions).</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*base</td><td>The SD host registers structure pointer.</td></tr>
    <tr><td class="paramname">*config</td><td>The pointer to the SD card read-write structure.</td></tr>
    <tr><td class="paramname">context</td><td>The pointer to the context structure <a class="el" href="structcy__stc__sd__host__context__t.html">cy_stc_sd_host_context_t</a> allocated by the user. The structure is used during the SD host operation for internal configuration and data retention. The user must not modify anything in this structure. If only the SD host functions which do not require context will be used, pass NULL as the pointer to the context.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group__group__sd__host__enums.html#gabbf5bb6a131cd8b9c529b7e36b35fe23">cy_en_sd_host_status_t</a> </dd></dl>

</div>
</div>
<a id="gabfb5430ccafd3a7a84b3bdf7eb106c98"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gabfb5430ccafd3a7a84b3bdf7eb106c98">&#9670;&nbsp;</a></span>Cy_SD_Host_Erase()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__sd__host__enums.html#gabbf5bb6a131cd8b9c529b7e36b35fe23">cy_en_sd_host_status_t</a> Cy_SD_Host_Erase </td>
          <td>(</td>
          <td class="paramtype">SDHC_Type *&#160;</td>
          <td class="paramname"><em>base</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>startAddr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>endAddr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__group__sd__host__enums.html#gafcc446fe80b86a86f74ba7794d1e3a8d">cy_en_sd_host_erase_type_t</a>&#160;</td>
          <td class="paramname"><em>eraseType</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcy__stc__sd__host__context__t.html">cy_stc_sd_host_context_t</a> const *&#160;</td>
          <td class="paramname"><em>context</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Erases the number block data of the SD card / eMMC. </p>
<dl class="section note"><dt>Note</dt><dd>This function starts the erase operation end exits. It is the user's responsibility to check when the erase operation completes. The erase operation completes when <a class="el" href="group__group__sd__host__low__level__functions.html#gacfa588e2d3797fab335cc8880d59d0ee">Cy_SD_Host_GetCardStatus</a> returns the status value where both ready-for-data (CY_SD_HOST_CMD13_READY_FOR_DATA) and card-transition (CY_SD_HOST_CARD_TRAN) bits are set. Also it is the user's responsibility to clear the CY_SD_HOST_CMD_COMPLETE flag after calling this function.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*base</td><td>The SD host registers structure pointer.</td></tr>
    <tr><td class="paramname">startAddr</td><td>The address to start erasing from.</td></tr>
    <tr><td class="paramname">endAddr</td><td>The address to stop erasing.</td></tr>
    <tr><td class="paramname">eraseType</td><td>Specifies the erase type (FULE, DISCARD).</td></tr>
    <tr><td class="paramname">context</td><td>The pointer to the context structure <a class="el" href="structcy__stc__sd__host__context__t.html">cy_stc_sd_host_context_t</a> allocated by the user. The structure is used during the SD host operation for internal configuration and data retention. The user must not modify anything in this structure. If only the SD host functions which do not require context will be used, pass NULL as the pointer to the context.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group__group__sd__host__enums.html#gabbf5bb6a131cd8b9c529b7e36b35fe23">cy_en_sd_host_status_t</a> </dd></dl>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part
<div id="nav-path" class="navpath">
    <ul>
        <li class="footer">
            Generated for <b>MTB CAT1 Peripheral driver library</b> by <b>Cypress Semiconductor Corporation</b>.
            All rights reserved.
        </li>
    </ul>
</div>
-->
</body>
</html>
